|
|
|
|
|
|
|
cTemp = cTemp + ";" + EOL
'
WrCreateIndex = cTemp
'
End Function |
|
|
|
|
|
|
|
|
The code for the WrCreateIndex method is a bit involved. First, this routine ignores any index that starts with "MSYS." This is assumed to be one of the Microsoft reserved system indexes. Next, all indexes are built to support foreign keys. They are handled later in the Relationships collection. Next, the Fields collection is built (including the ascending/descending attributes) and added to the definition. Finally, the attribute bits are checked for things like primary key, ignore nulls, and other settings. |
|
|
|
|
|
|
|
|
The wrCreateRelation Method |
|
|
|
|
|
|
|
|
Now it's time to add the wrCreateRelation routine. This builds any relationship definitions into the script. Add the code from Listing A.38 to your module. |
|
|
|
|
|
|
|
|
Listing A.38. Coding the wrCreateRelation function. |
|
|
|
|
|
|
|
|
Public Function wrCreateRelation(relObject As Relation) As String
'
' create relation/constraint code
'
Dim cTemp As String
Dim fldObject As Field
Dim cTable As String
Dim cForgTable As String
Dim cFields() As String
Dim x As Integer
Dim z As Integer
'
cTable = relObject.Table
cForgTable = relObject.ForeignTable
'
' ignore system tables
If UCase(Left(cTable, 4)) = "MSYS" Then
wrCreateRelation = ""
Exit Function
End If
If UCase(Left(cForgTable, 4)) = "MSYS" Then
wrCreateRelation = ""
Exit Function
End If
' |
|
|
|
|
|